﻿namespace Tetris.Game.ControlsBase.Common
{
    public static class ShapeTypeEx
    {
        public static ShapeColor GetShapeColor(this ShapeType shapeType)
        {
            return shapeType switch
            {
                ShapeType.O => OShapeColor,
                ShapeType.J => JShapeColor,
                ShapeType.I => IShapeColor,
                ShapeType.L => LShapeColor,
                ShapeType.S => SShapeColor,
                ShapeType.T => TShapeColor,
                ShapeType.Z => ZShapeColor,
                _ => OShapeColor
            };
        }
        public static ShapeColor OShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(197, 29, 30);
                color.InnerColor = Color.FromArgb(204, 11, 16);
                color.UpperTrapezoidColor = Color.FromArgb(240, 127, 91);
                color.RightTrapezoidColor = color.UpperTrapezoidColor;
                color.LeftTrapezoidColor = Color.FromArgb(219, 23, 30);
                color.UnderTrapezoidColor = color.LeftTrapezoidColor;
                color.Alpha = 150;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor JShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(66, 161, 59);
                color.InnerColor = Color.FromArgb(55, 154, 48);
                color.UpperTrapezoidColor = Color.FromArgb(157, 202, 132);
                color.RightTrapezoidColor = color.UpperTrapezoidColor;
                color.LeftTrapezoidColor = Color.FromArgb(52, 139, 47);
                color.UnderTrapezoidColor = color.LeftTrapezoidColor;
                color.Alpha = 60;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor IShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(68, 123, 131);
                color.InnerColor = Color.FromArgb(88, 176, 188);
                color.UpperTrapezoidColor = Color.FromArgb(99, 187, 199);
                color.RightTrapezoidColor = Color.FromArgb(163, 216, 226);
                color.LeftTrapezoidColor = color.UpperTrapezoidColor;
                color.UnderTrapezoidColor = color.RightTrapezoidColor;
                color.Alpha = 220;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor LShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(36, 106, 162);
                color.InnerColor = Color.FromArgb(20, 101, 165);
                color.UpperTrapezoidColor = Color.FromArgb(134, 165, 211);
                color.RightTrapezoidColor = color.UpperTrapezoidColor;
                color.LeftTrapezoidColor = Color.FromArgb(28, 110, 176);
                color.UnderTrapezoidColor = color.LeftTrapezoidColor;
                color.Alpha = 150;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor SShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(139, 74, 137);
                color.InnerColor = Color.FromArgb(137, 64, 135);
                color.UpperTrapezoidColor = Color.FromArgb(182, 132, 185);
                color.RightTrapezoidColor = color.UpperTrapezoidColor;
                color.LeftTrapezoidColor = Color.FromArgb(135, 68, 133);
                color.UnderTrapezoidColor = color.LeftTrapezoidColor;
                color.Alpha = 50;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor TShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(212, 204, 64);
                color.InnerColor = Color.FromArgb(234, 213, 0);
                color.UpperTrapezoidColor = Color.FromArgb(255, 242, 109);
                color.RightTrapezoidColor = color.UpperTrapezoidColor;
                color.LeftTrapezoidColor = Color.FromArgb(216, 197, 6);
                color.UnderTrapezoidColor = color.LeftTrapezoidColor;
                color.Alpha = 150;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor ZShapeColor
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(168, 101, 5);
                color.InnerColor = Color.FromArgb(219, 132, 0);
                color.UpperTrapezoidColor = Color.FromArgb(189, 118, 6);
                color.RightTrapezoidColor = Color.FromArgb(245, 188, 101);
                color.LeftTrapezoidColor = color.UpperTrapezoidColor;
                color.UnderTrapezoidColor = color.RightTrapezoidColor;
                color.Alpha = 150;
                color.FrameTrapezoidColor = Color.FromArgb(color.Alpha, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }
        public static ShapeColor DefaultColor2
        {
            get
            {
                var color = new ShapeColor();
                color.OuterColor = Color.FromArgb(254, 243, 123);
                color.InnerColor = Color.Green;
                color.UpperTrapezoidColor = Color.Blue;
                color.RightTrapezoidColor = Color.Red;
                color.LeftTrapezoidColor = color.RightTrapezoidColor;
                color.UnderTrapezoidColor = color.UpperTrapezoidColor;
                color.FrameTrapezoidColor = Color.FromArgb(50, color.InnerColor.R, color.InnerColor.G, color.InnerColor.B);
                return color;
            }
        }

        public static Size GetShapeDefaultSize(this ShapeType shapeType)
        {
            return shapeType switch
            {
                ShapeType.O => new Size(72, 72),
                ShapeType.J => new Size(108, 72),
                ShapeType.I => new Size(36, 144),
                ShapeType.L => new Size(108, 72),
                ShapeType.S => new Size(108, 72),
                ShapeType.T => new Size(72, 108),
                ShapeType.Z => new Size(72, 108),
                _ => new Size(72, 72)
            };
        }
        public static int GetShapeTypeHeight(this ShapeType shapeType)
        {
            return shapeType switch
            {
                ShapeType.O => 2,
                ShapeType.J => 2,
                ShapeType.I => 4,
                ShapeType.L => 2,
                ShapeType.S => 3,
                ShapeType.T => 3,
                ShapeType.Z => 2,
                _ => 2
            };
        }
    }
}
